package c.e.a.b.f.b;

import c.e.a.b.e.c.n0;
import c.e.a.b.e.c.p0;
import c.e.a.b.e.c.p0.b;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;

/* compiled from: com.google.android.gms:play-services-measurement@@18.0.0 */
public abstract class ea {
    public String a;
    public int b;
    public Boolean c;
    public Boolean d;
    public Long e;
    public Long f;

    public ea(String str, int i) {
        this.a = str;
        this.b = i;
    }

    public static Boolean b(long j, n0 n0Var) {
        try {
            return f(new BigDecimal(j), n0Var, 0.0d);
        } catch (NumberFormatException unused) {
            return null;
        }
    }

    public static Boolean c(Boolean bool, boolean z) {
        if (bool == null) {
            return null;
        }
        return Boolean.valueOf(bool.booleanValue() != z);
    }

    public static Boolean d(String str, n0 n0Var) {
        if (!q9.P(str)) {
            return null;
        }
        try {
            return f(new BigDecimal(str), n0Var, 0.0d);
        } catch (NumberFormatException unused) {
            return null;
        }
    }

    public static Boolean e(String str, p0 p0Var, q3 q3Var) {
        b bVar = b.REGEXP;
        b bVar2 = b.IN_LIST;
        Objects.requireNonNull(p0Var, "null reference");
        Boolean bool = null;
        if (str == null) {
            return null;
        }
        if (p0Var.u() && p0Var.v() != b.UNKNOWN_MATCH_TYPE) {
            String x;
            List list;
            if (p0Var.v() == bVar2) {
                if (p0Var.B() == 0) {
                    return null;
                }
            } else if (!p0Var.w()) {
                return null;
            }
            b v = p0Var.v();
            boolean z = p0Var.z();
            if (z || v == bVar || v == bVar2) {
                x = p0Var.x();
            } else {
                x = p0Var.x().toUpperCase(Locale.ENGLISH);
            }
            if (p0Var.B() == 0) {
                list = null;
            } else {
                List<String> list2 = p0Var.A();
                if (!z) {
                    ArrayList arrayList = new ArrayList(list2.size());
                    for (String toUpperCase : list2) {
                        arrayList.add(toUpperCase.toUpperCase(Locale.ENGLISH));
                    }
                    list2 = Collections.unmodifiableList(arrayList);
                }
            }
            Object obj = v == bVar ? x : null;
            if (v != bVar2 ? x != null : !(list2 == null || list2.size() == 0)) {
                CharSequence str2;
                if (!(z || v == bVar)) {
                    str2 = str2.toUpperCase(Locale.ENGLISH);
                }
                switch (aa.a[v.ordinal()]) {
                    case 1:
                        try {
                            bool = Boolean.valueOf(Pattern.compile(obj, z ? 0 : 66).matcher(str2).matches());
                            break;
                        } catch (PatternSyntaxException unused) {
                            if (q3Var != null) {
                                q3Var.i.b("Invalid regular expression in REGEXP audience filter. expression", obj);
                                break;
                            }
                        }
                        break;
                    case 2:
                        bool = Boolean.valueOf(str2.startsWith(x));
                        break;
                    case 3:
                        bool = Boolean.valueOf(str2.endsWith(x));
                        break;
                    case 4:
                        bool = Boolean.valueOf(str2.contains(x));
                        break;
                    case 5:
                        bool = Boolean.valueOf(str2.equals(x));
                        break;
                    case 6:
                        bool = Boolean.valueOf(list2.contains(str2));
                        break;
                }
            }
        }
        return bool;
    }

    /* JADX WARNING: Missing block: B:34:0x0082, code skipped:
            if (r3 != null) goto L_0x0084;
     */
    public static java.lang.Boolean f(java.math.BigDecimal r9, c.e.a.b.e.c.n0 r10, double r11) {
        /*
        r0 = "null reference";
        java.util.Objects.requireNonNull(r10, r0);
        r0 = r10.u();
        r1 = 0;
        if (r0 == 0) goto L_0x010d;
    L_0x000c:
        r0 = r10.v();
        r2 = c.e.a.b.e.c.n0.a.UNKNOWN_COMPARISON_TYPE;
        if (r0 != r2) goto L_0x0016;
    L_0x0014:
        goto L_0x010d;
    L_0x0016:
        r0 = r10.v();
        r2 = c.e.a.b.e.c.n0.a.BETWEEN;
        if (r0 != r2) goto L_0x002b;
    L_0x001e:
        r0 = r10.A();
        if (r0 == 0) goto L_0x002a;
    L_0x0024:
        r0 = r10.C();
        if (r0 != 0) goto L_0x0032;
    L_0x002a:
        return r1;
    L_0x002b:
        r0 = r10.y();
        if (r0 != 0) goto L_0x0032;
    L_0x0031:
        return r1;
    L_0x0032:
        r0 = r10.v();
        r3 = r10.v();
        if (r3 != r2) goto L_0x0067;
    L_0x003c:
        r3 = r10.B();
        r3 = c.e.a.b.f.b.q9.P(r3);
        if (r3 == 0) goto L_0x0066;
    L_0x0046:
        r3 = r10.D();
        r3 = c.e.a.b.f.b.q9.P(r3);
        if (r3 != 0) goto L_0x0051;
    L_0x0050:
        goto L_0x0066;
    L_0x0051:
        r3 = new java.math.BigDecimal;	 Catch:{ NumberFormatException -> 0x0066 }
        r4 = r10.B();	 Catch:{ NumberFormatException -> 0x0066 }
        r3.<init>(r4);	 Catch:{ NumberFormatException -> 0x0066 }
        r4 = new java.math.BigDecimal;	 Catch:{ NumberFormatException -> 0x0066 }
        r10 = r10.D();	 Catch:{ NumberFormatException -> 0x0066 }
        r4.<init>(r10);	 Catch:{ NumberFormatException -> 0x0066 }
        r10 = r3;
        r3 = r1;
        goto L_0x007d;
    L_0x0066:
        return r1;
    L_0x0067:
        r3 = r10.z();
        r3 = c.e.a.b.f.b.q9.P(r3);
        if (r3 != 0) goto L_0x0072;
    L_0x0071:
        return r1;
    L_0x0072:
        r3 = new java.math.BigDecimal;	 Catch:{ NumberFormatException -> 0x010d }
        r10 = r10.z();	 Catch:{ NumberFormatException -> 0x010d }
        r3.<init>(r10);	 Catch:{ NumberFormatException -> 0x010d }
        r10 = r1;
        r4 = r10;
    L_0x007d:
        if (r0 != r2) goto L_0x0082;
    L_0x007f:
        if (r10 != 0) goto L_0x0084;
    L_0x0081:
        return r1;
    L_0x0082:
        if (r3 == 0) goto L_0x010d;
    L_0x0084:
        r2 = c.e.a.b.f.b.aa.b;
        r0 = r0.ordinal();
        r0 = r2[r0];
        r2 = -1;
        r5 = 0;
        r6 = 1;
        if (r0 == r6) goto L_0x0101;
    L_0x0091:
        r7 = 2;
        if (r0 == r7) goto L_0x00f5;
    L_0x0094:
        r8 = 3;
        if (r0 == r8) goto L_0x00ad;
    L_0x0097:
        r11 = 4;
        if (r0 == r11) goto L_0x009b;
    L_0x009a:
        goto L_0x010d;
    L_0x009b:
        r10 = r9.compareTo(r10);
        if (r10 == r2) goto L_0x00a8;
    L_0x00a1:
        r9 = r9.compareTo(r4);
        if (r9 == r6) goto L_0x00a8;
    L_0x00a7:
        r5 = 1;
    L_0x00a8:
        r9 = java.lang.Boolean.valueOf(r5);
        return r9;
    L_0x00ad:
        r0 = 0;
        r10 = (r11 > r0 ? 1 : (r11 == r0 ? 0 : -1));
        if (r10 == 0) goto L_0x00e9;
    L_0x00b3:
        r10 = new java.math.BigDecimal;
        r10.<init>(r11);
        r0 = new java.math.BigDecimal;
        r0.<init>(r7);
        r10 = r10.multiply(r0);
        r10 = r3.subtract(r10);
        r10 = r9.compareTo(r10);
        if (r10 != r6) goto L_0x00e4;
    L_0x00cb:
        r10 = new java.math.BigDecimal;
        r10.<init>(r11);
        r11 = new java.math.BigDecimal;
        r11.<init>(r7);
        r10 = r10.multiply(r11);
        r10 = r3.add(r10);
        r9 = r9.compareTo(r10);
        if (r9 != r2) goto L_0x00e4;
    L_0x00e3:
        r5 = 1;
    L_0x00e4:
        r9 = java.lang.Boolean.valueOf(r5);
        return r9;
    L_0x00e9:
        r9 = r9.compareTo(r3);
        if (r9 != 0) goto L_0x00f0;
    L_0x00ef:
        r5 = 1;
    L_0x00f0:
        r9 = java.lang.Boolean.valueOf(r5);
        return r9;
    L_0x00f5:
        r9 = r9.compareTo(r3);
        if (r9 != r6) goto L_0x00fc;
    L_0x00fb:
        r5 = 1;
    L_0x00fc:
        r9 = java.lang.Boolean.valueOf(r5);
        return r9;
    L_0x0101:
        r9 = r9.compareTo(r3);
        if (r9 != r2) goto L_0x0108;
    L_0x0107:
        r5 = 1;
    L_0x0108:
        r9 = java.lang.Boolean.valueOf(r5);
        return r9;
    L_0x010d:
        return r1;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.e.a.b.f.b.ea.f(java.math.BigDecimal, c.e.a.b.e.c.n0, double):java.lang.Boolean");
    }

    public abstract int a();

    public abstract boolean g();

    public abstract boolean h();
}
